var prefix = "/jzweb/informationImportUser";
var prefixs = "/jzweb/examinationResults";
$(function () {
    load();
    $.ajax({
        url: "/jzweb/informationBatch/list", // 替换为你的后端接口URL
        method: "GET",
        data: {pageNumber: 1, pageSize: 1000}, // 向后端传递姓名参数
        dataType: "json",
        success: function (data) {
            console.log(data.data.records, 'ajax')
            let declaredCareers = $('#subject')
            declaredCareers.append('<option value="">请选择</option>')
            $.each(data.data.records, function (index, item) {
                declaredCareers.append('<option value="' + item.profileName + '">' + item.profileName + '</option>');
            });
            $('#declaredCareers').val(declaredCareersvalue)
        },
    })
    //认证批次
    $('#authenticationId').selectPage({
        showField: 'name',
        keyField: 'id',
        data: prefixs + '/selCbatch',
        //选择省份时，清空城市列表已选中的项目
        eSelect: function (data) {
            if (data && lastProvince !== data.id) {
                $('#authenticationId').selectPageClear();
            }
        },
        eAjaxSuccess: function (d) {
            var result;
            if (d) result = d.data;
            else result = undefined;
            return result;
        }
    });
});

var selectedValues = []
var exportList = []
var selectedValue = ''
var sfzuploadedImages = []
var zjzuploadedImages = []
var byzuploadedImages = []

function load() {

    $('#exampleTable')
        .bootstrapTable(
            {
                method: 'get', // 服务器数据的请求方式 get or post
                url: prefix + "/selImportUserList", // 服务器数据的加载地址
                //	showRefresh : true,
                //	showToggle : true,
                //	showColumns : true,
                iconSize: 'outline',
                toolbar: '#exampleToolbar',
                striped: true, // 设置为true会有隔行变色效果
                dataType: "json", // 服务器返回的数据类型
                pagination: true, // 设置为true会在底部显示分页条
                singleSelect: false, // 设置为true将禁止多选
                contentType: "application/json",
                // //发送到服务器的数据编码类型
                pageSize: 10, // 如果设置了分页，每页数据条数
                pageNumber: 1, // 如果设置了分布，首页页码
                //search : true, // 是否显示搜索框
                showColumns: false, // 是否显示内容下拉框（选择显示的列）
                sidePagination: "server", // 设置在哪里进行分页，可选值为"client" 或者 "server"
                queryParamsType: "",
                // //设置为limit则会发送符合RESTFull格式的参数
                queryParams: function (params) {
                    return {
                        //说明：传入后台的参数包括offset开始索引，limit步长，sort排序列，order：desc或者,以及所有列的键值对
                        current: params.pageNumber,
                        size: params.pageSize,
                        mobile: $('#seachmobile').val(),
                        createTime: $('#startdateAdd').val(),
                        endTime: $('#enddateAdd').val() ? $('#enddateAdd').val() : $('#startdateAdd').val(),
                        personType: $('#seachpersonType').val() == '' ? -1 : parseInt($('#seachpersonType').val()),
                        checkStatus: $('#seachstatus').val() == '' ? -1 : parseInt($('#seachstatus').val()),
                        name: $('#seachname').val(),
                        examTime: $('#kbTime').val(),
                        declaredCareers: $('#subject').val()
                        // authenticationId:$('#authenticationId').val(),
                    };
                },
                // //请求服务器数据时，你可以通过重写参数的方式添加一些额外的参数，例如 toolbar 中的参数 如果
                // queryParamsType = 'limit' ,返回参数必须包含
                // limit, offset, search, sort, order 否则, 需要包含:
                // pageSize, pageNumber, searchText, sortName,
                // sortOrder.
                // 返回false将会终止请求
                responseHandler: function (res) {
                    console.log(res);
                    return {
                        "total": res.data.total,//总数
                        "rows": res.data.records   //数据
                    };
                },
                onCheck: function (row) {
                    exportList.push(row.id)
                    console.log(exportList)
                },
                onUncheck: function (row) {
                    // 在这里可以根据需要处理数据，比如从某个数据集合中移除它
                    var index = exportList.indexOf(row.id); // 假设yourDataArray是你的数据源
                    if (index > -1) {
                        exportList.splice(index, 1); // 从数组中移除对应的对象
                    }
                    console.log(exportList)
                },
                onCheckAll: function (rows) {
                    for (var i = 0; i < rows.length; i++) {
                        let row = rows[i]
                        exportList.push(row.id);
                        //alert(rows[i].ResultName)
                    }

                },
                onUncheckAll: function (row) {
                    for (var i = 0; i < row.length + 1; i++) {
                        exportList.splice(i, row.length);
                        //alert(rows[i].ResultName)
                    }
                    exportList = []
                    console.log(exportList)
                },
                columns: [
                    {
                        checkbox: true
                    },
                    {
                        field: 'id', // 列字段名
                        title: '序号' // 列标题
                    },
                    {
                        field: 'name',
                        title: '姓名'
                    },
                    {
                        field: 'mobile',
                        title: '联系方式'
                    },
                    {
                        field: 'education',
                        title: '学历',
                        formatter: function (value, row, index) {
                            if (value == 1) {
                                return '<span class="label label-primary">初中</span>';
                            } else if (value == 2) {
                                return '<span class="label label-success">高中</span>';
                            } else if (value == 3) {
                                return '<span class="label label-fail">中专</span>';
                            } else if (value == 4) {
                                return '<span class="label label-fail">大专</span>';
                            } else if (value == 5) {
                                return '<span class="label label-fail">大学</span>';
                            } else if (value == 6) {
                                return '<span class="label label-fail">硕士</span>';
                            } else if (value == 7) {
                                return '<span class="label label-fail">博士</span>';
                            }
                        }
                    },

                    {
                        field: 'personType',
                        title: '人员类别',
                        formatter: function (value, row, index) {
                            if (value == 0) {
                                return '<span class="label label-primary">学生</span>';
                            } else if (value == 1) {
                                return '<span class="label label-success">企业员工</span>';
                            } else if (value == 2) {
                                return '<span class="label label-fail">社会人员</span>';
                            }
                        }
                    },
                    {
                        field: 'declaredCareers',
                        title: '申报职业',
                    },

                    {
                        field: 'idcardAddress',
                        title: '省份城市'
                    },
                    {
                        field: 'workTime',
                        title: '职业年限'
                    },
                    {
                        field: 'createTime',
                        title: '申请时间'
                    },
                    {
                        field: 'examTime',
                        title: '开班时间',
                    },

                    {
                        field: 'checkStatus',
                        title: '审核状态',
                        formatter: function (value, row, index) {
                            if (value == 0) {
                                return '<span class="label label-primary">未审核</span>';
                            } else if (value == 1) {
                                return '<span class="label label-success">审核通过</span>';
                            } else if (value == 2) {
                                return '<span class="label label-fail">审核拒绝</span>';
                            }
                        }
                    },


                    {
                        title: '操作',
                        field: 'id',
                        align: 'center',
                        formatter: function (value, row, index) {
                            console.log(row, 'anniu')
                            //
                            var e = '<a  shiro:hasPermission="jzweb:informationImportUser:updateImportUser"  class="btn btn-primary btn-sm ' + '" href="#" mce_href="#" title="编辑"  onclick="addedit(\'' + row.id + '\')">编辑</a>';
                            var d = '<a class="btn btn-warning btn-sm ' + '" href="#" title="详情"  mce_href="#" onclick="xiangQing(\'' + row.id + '\')">详情</a>';
                            var f = row.checkStatus == '0' ? '<a class="btn btn-success btn-sm" href="#" title="审核"  mce_href="#" onclick="shenHe(\'' + row.id + '\')">审核<i class="fa fa-key"></i></a>' : '';
                            // var f = '<a class="btn btn-success btn-sm" href="#" title="导出"  mce_href="#" onclick="clickExcelFile(\''
                            // 	+ row.id
                            // 	+ '\')"><i class="fa fa-key"></i></a>';
                            return e + d + f;
                        },
                        formatterParams: function (value, row, index) {
                            // 这个函数将在每次格式化前被调用，可以返回一个对象作为参数传递给formatter
                            return {
                                extraData: row.someOtherField, // 传递行中的其他字段作为额外参数
                                moreInfo: "附加信息"
                            };
                        }
                    }]
            });
}

// 修改getDatalist函数以接受字符串化的row对象
layui.use(['upload', 'laydate'], function () {
    var laydate = layui.laydate;
    //执行一个laydate实例
    laydate.render({
        elem: '#startdateAdd' //指定元素
    });
    laydate.render({
        elem: '#enddateAdd' //指定元素
    });
    laydate.render({
        elem: '#kbTime' //指定元素
    });
});

function reLoad() {
    $('#exampleTable').bootstrapTable('refresh');
}

//订单记录导出
function handleexportList() {
    if (exportList.length == '0') {
        layer.msg('请勾选需要导出的数据')
        return false;
    }
    window.location.href = `/jzweb/informationImportUser/downloadImportUser?ids=${exportList.join(',')}`
}


//订单记录导出
function clickExcelFile(id) {

    layer.confirm('是否导出相应记录？', {
        btn1: function (index) {
            window.location.href = prefix + '/exportWord?id=' + id;
            layer.close(index)
        }
    })
}

function add() {
    layer.open({
        type: 2,
        title: '增加',
        maxmin: true,
        shadeClose: false, // 点击遮罩关闭层
        area: ['800px', '520px'],
    });
}

//批量审核
function examineyys(prefix) {
    var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行，当没有选择的记录时，返回一个空数组
    if (rows.length == 0) {
        layer.msg("请选择要审核的数据");
        return;
    }
    var ids = new Array();
    // 遍历所有选择的行数据，取每条数据对应的ID
    $.each(rows, function (i, row) {
        ids[i] = row['id'];
    });
    layer.confirm("确认要审核选中的'" + rows.length + "'条数据吗?", {
        btn: ['通过', '不通过'],
        btn1: function () {
            console.log("yes");
            $.ajax({
                type: 'POST',
                data: {
                    "ids": ids,
                    state: 1,
                    remark: ""
                },
                url: prefix + '/review',
                success: function (r) {
                    if (r.code == 0) {
                        layer.msg(r.msg);
                        reLoad();
                    } else {
                        layer.msg(r.msg);
                    }
                }
            });
        },
        btn2: function (pass, index) {
            layer.prompt({
                title: '请对这' + rows.length + '条数据填写未通过意见，并确认：',
                formType: 2
            }, function (remark, index) {
                console.log("pass", remark);
                $.ajax({
                    type: 'POST',
                    data: {
                        "ids": ids,
                        state: 2,
                        remark: remark
                    },
                    url: prefix + '/review',
                    success: function (r) {
                        if (r.code == 0) {
                            layer.msg(r.msg);
                            reLoad();
                        } else {
                            layer.msg(r.msg);
                        }
                    }
                });
                layer.closeAll();

            });
            return false
        }

    });
}

// function edit(id) {
// 	layer.open({
// 		type : 2,
// 		title : '编辑',
// 		maxmin : true,
// 		shadeClose : false, // 点击遮罩关闭层
// 		area : [ '800px', '520px' ],
// 		content : prefix + '/edit/' + id // iframe的url
// 	});
// }
var editbooklist = []
var editworklist = []
var lookeditbooklist = []
var lookeditworklist = []
var editid = ''
var index1 = ''

function uniqueByProperty(arr, prop) {
    const map = new Map();
    return arr.filter(item => !map.has(item[prop]) && map.set(item[prop], item));
}

var checkvalue = []

function addeditSubmit(isadd) {
    $('input[type="checkbox"]:checked').each(function () {
        // this.value就是当前选中checkbox的值
        console.log(this.value);
        checkvalue.push(this.value)
    });
    if (!$('#tcname').val() || !$('#tcmobile').val() || !$('#sex').val() || !$('#born').val() || !$('#education').val() || !$('#major').val() || !$('#tcpersonType').val() || $('#certificateType').val()) {
        console.log(111)
        layer.msg('请将带*模块的信息填写完整')
        return false;
    }
    if (!$('#idcardAddress').val() || !$('#idcardNumber').val() || !$('#examTime').val() || !$('#declaredCareers').val() || !$('#declaredLevel').val()) {
        console.log(222)
        console.log($('#certificateType').val(), $('#idcardAddress').val(), $('#idcardNumber').val(), $('#workUnit').val(), $('#examTime').val(), $('#workTime').val(), $('#declaredCareers').val(), $('#declaredLevel').val())
        layer.msg('请将带*模块的信息填写完整')
        return false;
    }
    if ($('#previewUrl').val()=='' || sfzuploadedImages.length<1|| byzuploadedImages.length<1) {
        console.log(333)
        layer.msg('请将带*模块的信息填写完整')
        return false;
    }
    // 新增接口
    let url = "/jzweb/informationImportUser/addImportUser"
    if (editid != 'add') {
        // 编辑接口
        url = "/jzweb/informationImportUser/updateImportUser"
    }
    zjzuploadedImages=[...new Set(zjzuploadedImages)]
    sfzuploadedImages=[...new Set(sfzuploadedImages)]
    byzuploadedImages=[...new Set(byzuploadedImages)]
    $.ajax({
        url: url,
        type: "post",
        contentType: 'application/json', // 假设期望从服务器接收的数据格式为json
        data: JSON.stringify({
            'id': editid == 'add' ? '' : editid,
            'name': $('#tcname').val(),
            'mobile': $('#tcmobile').val(),
            'sex': $('#sex').val(),
            'born': $('#born').val(),
            'education': $('#education').val(),
            'major': $('#major').val(),
            'personType': $('#tcpersonType').val(),
            'certificateType': $('#certificateType').val(),
            'idcardAddress': $('#idcardAddress').val(),
            'idcardNumber': $('#idcardNumber').val(),
            'workUnit': $('#workUnit').val(),
            'examTime': $('#examTime').val(),
            'declaredCareers': $('#declaredCareers').val(),
            'declaredLevel': $('#declaredLevel').val(),
            // 'declaredSubject': $('#declaredSubject').val(),
            'declaredSubject': checkvalue.join(','),
            // 'personPhoto': $('#img1').val(),
            // 'idcardPhoto': $('#img2').val(),
            // 'graducationPhoto': $('#img3').val(),
            'personPhoto': $('#previewUrl').val(),
            'idcardPhoto': JSON.stringify(sfzuploadedImages),
            'graducationPhoto': JSON.stringify(byzuploadedImages),
            'certificateInfoConds': editid != 'add' ? uniqueByProperty(editbooklist, 'number') : addbooklistdata,
            'experinceConds': editid != 'add' ? uniqueByProperty(editworklist, 'endTime') : addworklistdata,
        }),
        success: function (r) {
            if (r.data == '小程序未登录，用户没有查询到') {
                layer.msg('小程序未登录，用户没有查询到"')
                return false;
            }
            if (r.code == 0) {
                layer.msg(r.msg);
                layer.close(index1)
                editworklist = []
                editbooklist = []
                zjzuploadedImages=[]
                sfzuploadedImages=[]
                byzuploadedImages=[]
                addbooklistdata = []
                addworklistdata = []
                lookeditbooklist = []
                lookeditworklist = []
                checkvalue = []
                reLoad();
            } else {
                layer.msg(r.msg);
            }
        }
    });
}

var dialogTitle = ''

// 新增编辑
function addedit(id) {
    zjzuploadedImages=[]
    sfzuploadedImages=[]
    byzuploadedImages=[]
    editid = id
    let declaredCareersvalue=''
    let imgurl1 =[]
    let imgurl2 =[]
    let imgurl3 =[]
    dialogTitle = '新增'
    if (id != 'add') {
        dialogTitle = '编辑'
        $.ajax({
            type: 'GET',
            data: {
                id: id
            },
            url: '/jzweb/informationImportUser/getInfo',
            success: function (r) {
                selectedValues = r.data.declaredSubject.split(',')
                $("input[type='checkbox']").each(function () {
                    // 如果当前复选框的值在selectedValues数组中，则设置为选中状态
                    if ($.inArray($(this).val(), selectedValues) !== -1) {
                        $(this).prop("checked", true);
                    } else {
                        $(this).prop("checked", false);
                    }
                });
                console.log(selectedValues, 'selectedValues')
                $('#tcname').val(r.data.name)
                $('#tcmobile').val(r.data.mobile)
                var mobileSelect = $("#tcmobile");
                mobileSelect.empty(); // 清空原有的选项
                // 遍历返回的手机号码数据，添加到select中
                mobileSelect.append('<option value="' + r.data.mobile + '">' + r.data.mobile + '</option>')
                $('#sex').val(r.data.sex)
                $('#born').val(r.data.born)
                $('#education').val(r.data.education)
                $('#major').val(r.data.major)
                $('#tcpersonType').val(r.data.personType)
                $('#idcardAddress').val(r.data.idcardAddress)
                $('#idcardNumber').val(r.data.idcardNumber)
                $('#workUnit').val(r.data.workUnit)
                $('#examTime').val(r.data.examTime)
                var mobileSelect = $("#examTime");
                mobileSelect.empty(); // 清空原有的选项
                // 遍历返回的手机号码数据，添加到select中
                mobileSelect.append('<option value="' + r.data.examTime + '">' + r.data.examTime + '</option>')
                $('#declaredCareers').val(r.data.declaredCareers)
                declaredCareersvalue=r.data.declaredCareers
                $('#declaredLevel').val(r.data.declaredLevel)
                $('#declaredSubject').val(r.data.declaredSubject)
                $('#workTime').val(r.data.workTime)
                 imgurl1 = r.data.personPhoto
                 imgurl2 = JSON.parse(r.data.idcardPhoto)
                 imgurl3 = JSON.parse(r.data.graducationPhoto)
                // var imgHtml1 = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                //     '<img style="height: 100px" src="' + imgurl1 + '" class="layui-upload-img"/>' +
                //     '<span class="demo-delete" style="color: #f00;position: absolute;left: 88%;font-size: 30px; cursor: pointer;" data-id="' + imgurl1+ '"></span></div>';
                // $('#upload-demo-preview1').append(imgHtml1);
                $('#preview1').attr('src',imgurl1)
                $('#previewUrl').val(imgurl1)
                imgurl2.forEach(function (item) {
                    var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                        '<img style="height: 100px" src="' + item + '" class="layui-upload-img"/>' +
                        '<span class="demo-delete" style="color: #f00;position: absolute;left: 88%;font-size: 30px; cursor: pointer;" data-id="' + item+ '">×</span></div>';
                    $('#upload-demo-preview2').append(imgHtml);
                    // 将初始图片数据加入到数组中
                    sfzuploadedImages.push(item);
                });
                $('#upload-demo-preview2').on('click', '.demo-delete', function () {
                    $(this).closest('.upload-demo').remove();
                    let objId = $(this).attr('data-id');
                    console.log(objId, '000');
                    deleteImage(sfzuploadedImages, objId); // 调用删除函数，注意调整参数或内部逻辑
                });
                imgurl3.forEach(function (item) {
                    var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                        '<img style="height: 100px" src="' + item + '" class="layui-upload-img"/>' +
                        '<span class="demo-delete" style="color: #f00;position: absolute;left: 88%;font-size: 30px; cursor: pointer;" data-id="' + item+ '">×</span></div>';
                    $('#upload-demo-preview3').append(imgHtml);
                    // 将初始图片数据加入到数组中
                    byzuploadedImages.push(item);
                });
                $('#upload-demo-preview3').on('click', '.demo-delete', function () {
                    $(this).closest('.upload-demo').remove();
                    let objId = $(this).attr('data-id');
                    console.log(objId, '000');
                    deleteImage(byzuploadedImages, objId); // 调用删除函数，注意调整参数或内部逻辑
                });
                $('.layui-upload-img').off('click').on('click', function(){
                    var imgSrc = $(this).attr('src');
                    showImagePreview(imgSrc);
                });


                editbooklist = r.data.certificateInfoVos
                lookeditbooklist = r.data.certificateInfoVos
                lookeditworklist = r.data.experinceVos
                editworklist = r.data.experinceVos
                // 使用$.each遍历JSON数据
                $.each(lookeditbooklist, function (index, item) {
                    var listItem = $('<div >');
                    var photo = $('<img src="' + item.photo + '" style="margin: 10px 27px;;width: 100px;display: inline-block;">');
                    var certificateTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.certificateTime);
                    var level = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.level);
                    var career = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.career);
                    var deleteButton = $('<button>', {
                        class: 'deleteButton',
                        text: '删除'
                    });

                    // 绑定删除按钮的点击事件
                    deleteButton.click(function (event) {
                        layer.confirm('确定要删除该信息？', {
                            btn: ['确定', '取消']
                        }, function () {
                            console.log(editbooklist[index])
                            editbooklist[index].isDelete = '1'
                            // lookeditworklist[index].isDelete='1'
                            lookeditbooklist.splice(index, 1)
                            // 删除接口
                            event.preventDefault(); // 阻止默认行为，如链接跳转
                            listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                            layer.msg('删除成功');
                        })
                    });
                    // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
                    listItem.append(career).append(level).append(certificateTime).append(photo).append(deleteButton);
                    $('#worklist').append(listItem);
                });
                $.each(lookeditworklist, function (index, item) {
                    var listItem = $('<div >');
                    var contactMobile = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.contactMobile);
                    var contact = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.contact);
                    var job = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.job);
                    var workUnit = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.workUnit);
                    var startTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.startTime + '-' + item.endTime);
                    var deleteButton = $('<button>', {
                        class: 'deleteButton',
                        text: '删除'
                    });

                    // 绑定删除按钮的点击事件
                    deleteButton.click(function (event) {
                        layer.confirm('确定要删除该信息？', {
                            btn: ['确定', '取消']
                        }, function () {
                            console.log(item)
                            editworklist[index].isDelete = '1'
                            lookeditworklist[index].isDelete = '1'
                            lookeditworklist.splice(index, 1)
                            // 删除接口
                            event.preventDefault(); // 阻止默认行为，如链接跳转
                            listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                            layer.msg('删除成功');
                        })
                    });
                    // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
                    listItem.append(startTime).append(workUnit).append(job).append(contact).append(contactMobile).append(deleteButton);
                    $('#list').append(listItem);
                });
                $("input[type='checkbox']").each(function () {
                    // 如果当前复选框的值在selectedValues数组中，则设置为选中状态
                    if ($.inArray($(this).val(), selectedValues) !== -1) {
                        $(this).prop("checked", true);
                    } else {
                        $(this).prop("checked", false);
                    }
                });
                // $('#uploadDemoView1').removeClass('layui-hide').find('img').attr('src', imgurl1);
                // $('#img1').val(imgurl1);
                // $('#icon1').hide()
                // $('#icontext1').hide()
                // $('#hr1').hide()
                // $('#yubtn1').show()
                // $("input[name='picture1']").val(imgurl1)
                // $('#uploadDemoView2').removeClass('layui-hide').find('img').attr('src', imgurl2);
                // $('#img2').val(imgurl2);
                // $('#uploadDemoView2').removeClass('layui-hide').find('img').attr('src', imgurl2);
                // $('#icon2').hide()
                // $('#icontext2').hide()
                // $('#hr2').hide()
                // $('#yubtn2').show()
                // $("input[name='picture2']").val(imgurl2)
                // $('#uploadDemoView3').removeClass('layui-hide').find('img').attr('src', imgurl3);
                // $('#img3').val(imgurl3);
                // $('#uploadDemoView3').removeClass('layui-hide').find('img').attr('src', imgurl3);
                // $('#icon3').hide()
                // $('#icontext3').hide()
                // $('#hr3').hide()
                // $('#yubtn3').show()
                // $("input[name='picture3']").val(imgurl3)
            }
        })
    }

    index1 = layer.open({
        content: `
          <div >
          <div class="title">基础信息<span style="color: red;font-size: 20px">*</span></div>
           <div class="form-box" >
               <label>姓名：</label>
               <div class="layui-input-inline">
                  <input id="tcname" name="name"  type="text" required lay-verify="required" class="form-control" placeholder="请输入姓名">
               </div>
               <label>联系方式：</label>
               <div class="layui-input-inline">
               <select id="tcmobile"  name="mobile" style="width: 196px"   class="form-control" required lay-verify="required" lay-filter="select-filter">
                    <option value="">暂无数据</option></select>
<!--                  <input id="tcmobile" name="mobile"  type="text" required lay-verify="required" class="form-control" placeholder="请输入联系方式">-->
               </div>
               <label>性别：</label>
               <div class="layui-input-inline">
               <select id="sex" style="width: 196px" class="form-control" name="sex"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择性别">
                                <option value="">请选择</option>
                               <option value="1">男</option>
                               <option value="2">女</option>
                            </select>
<!--                  <input id="sex" name="sex"  type="text" required lay-verify="required"  >-->
               </div>
               <label>出生年月：</label>
               <div class="layui-input-inline">
               <input id="born" style="width:200px" name="born" class="form-control" type="text" placeholder="请输入出生年月">
<!--                  <input id="born" name="born" type="text" required lay-verify="required" class="form-control" placeholder="请输入出生年月">-->
               </div>
           </div>
           <div class="form-box" >
               <label>学历：</label>
               <div class="layui-input-inline">
               <select id="education" style="width: 196px" class="form-control" name="education"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择学历">
                               <option value="">请选择</option>
                               <option value="1">初中</option>
                               <option value="2">高中</option>
                               <option value="3">中专</option>
                               <option value="4">大专</option>
                               <option value="5">大学</option>
                               <option value="6">硕士</option>
                               <option value="7">博士</option>
                            </select>
<!--                  <input id="education" name="education"  type="text" required lay-verify="required" class="form-control" placeholder="请输入学历">-->
               </div>
               <label>所学专业：</label>
               <div class="layui-input-inline">
                  <input id="major" name="major"  type="text" required lay-verify="required" class="form-control" placeholder="请输入所学专业">
               </div>
               <label>人员类别：</label>
               <div class="layui-input-inline">
               <select id="tcpersonType" style="width: 196px" class="form-control" name="personType"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
                               <option value="">请选择</option>
                               <option value="0">学生</option>
                               <option value="1">企业员工</option>
                               <option value="2">社会人员</option>
                            </select>
<!--                  <input id="personType" name="personType" type="text" required lay-verify="required" class="form-control" placeholder="请输入人员类型">-->
               </div>
               <label>证件类型：</label>
               <div class="layui-input-inline">
                  <input disabled value="身份证"  type="text" required lay-verify="required" class="form-control" >
               </div>
           </div>
           <div class="form-box" >
               <label>身份证地址：</label>
               <div class="layui-input-inline">
                  <input id="idcardAddress" name="idcardAddress"  type="text" required lay-verify="required" class="form-control" placeholder="请输入身份证地址">
               </div>
               <label>身份证号：</label>
               <div class="layui-input-inline">
                  <input id="idcardNumber" name="idcardNumber"  type="text" required lay-verify="required" class="form-control" placeholder="请输入身份证号">
               </div>
               <label>工作单位：</label>
               <div class="layui-input-inline">
                  <input id="workUnit" name="workUnit"  type="text" required lay-verify="required" class="form-control" placeholder="请输入工作单位">
               </div>
               <label>职业年限：</label>
               <div class="layui-input-inline">
                  <input disabled id="workTime"  type="text" required lay-verify="required" class="form-control" placeholder="无需填写">
               </div>
           </div>
         
        </div>
        <div>
        <div class="title">申报信息 <span style="color: red;font-size: 20px">*</span></div>
         <div class="form-box" >
               <label>申报职业：</label>
               <div class="layui-input-inline">
               <select id="declaredCareers" style="width: 196px" class="form-control" name="declaredCareers"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
<!--                               <option value="">请选择</option>-->
<!--                               <option value="育婴师">育婴师</option>-->
<!--                               <option value="保育师">保育师</option>-->
<!--                               <option value="养老护理员">养老护理员</option>-->
              </select>
<!--                  <input id="declaredCareers" name="declaredCareers" type="text" required lay-verify="required" class="form-control" placeholder="请输入申报职业">-->
               </div>
              <label>开班时间：</label>
               <div class="layui-input-inline">
               <select id="examTime" name="examTime" style="width: 196px" class="form-control"   lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择开班时间">
                               <option value="">暂无数据</option></select>
                </select>
<!--                  <input id="examTime" name="examTime"  type="text" required lay-verify="required" class="form-control" placeholder="请输入开班时间">-->
               </div>
               <label>申报等级：</label>
               <div class="layui-input-inline">
               <select id="declaredLevel" style="width: 196px" class="form-control" name="declaredLevel"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
                               <option value="">请选择</option>
                               <option value="三级">三级</option>
                               <option value="四级">四级</option>
                               <option value="五级">五级</option>
                            </select>
<!--                  <input id="declaredLevel" name="declaredLevel"  type="text" required lay-verify="required" class="form-control" placeholder="请输入申报等级">-->
               </div>
               <label>申报科目：</label>
               <div class="layui-input-inline">
               <input name="select_item" type="checkbox" value="0" style="margin-right: 10px;"><span style="margin-top: 4px">理论</span>
               <input name="select_item" type="checkbox" value="1" style="margin-right: 10px"><span  style="margin-top: 4px">实操</span>
               <input name="select_item" type="checkbox" value="2" style="margin-right: 10px"><span  style="margin-top: 4px">综合</span>
<!--               <select id="declaredSubject" style="width: 196px" class="form-control" name="declaredSubject"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">-->
<!--                               <option value="">请选择</option>-->
<!--                               <option value="0">理论</option>-->
<!--                               <option value="1">实操</option>-->
<!--                               <option value="2">综合</option>-->
<!--                            </select>-->
<!--                  <input id="declaredSubject" name="declaredSubject"  type="text" required lay-verify="required" class="form-control" placeholder="请输入申报科目">-->
               </div>
           </div>
         </div>
         <div>
         <div class="title">证书信息</div>
         <div>
         <span  type="button" class="btn  btn-primary" style="margin-left: 60px;
    margin-top: 10px;
    margin-bottom: 10px;" onclick="addbooklist()">添加证书</span>
</div >
        <div>
        <div class="btitle"></div>
        <div style="display:flex;margin-left: 60px">
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">职业（工作）</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center">等级</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">签证日期</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center">证书图片</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">操作</div>
       </div>
       <div id="worklist" style="margin-left: 60px;"></div>
       <div id="bookemtry" style="text-align: center;margin: 20px 0px;display: none;  margin-right: 260px;">暂无数据</div>
       <div class="title" style="padding: 20px 0px">工作经历</div>
         <div>
         <span  type="button" class="btn  btn-primary" style="margin-left: 60px;
    margin-top: 10px;
    margin-bottom: 10px;" onclick="addworklist()">添加工作经历</span>
</div >
        <div>
        <div class="btitle"></div>
        <div style="display:flex;margin-left: 60px">
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">起止年月</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center">工作单位</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">工作岗位</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">单位联系人</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center">联系电话</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">操作</div>
       </div>
       <div>
       <div id="list" style="margin-left: 60px;"></div>
       <div id="workemtry" style="text-align: center;margin: 20px 0px; display: none;    margin-right: 200px;">暂无数据</div>
</div>
       <div class="title" style="padding: 20px 0px">证件信息<span style="color: red;font-size: 20px">*</span></div>
       <div style="display: flex;justify-content: space-around;flex-direction: column;padding-left: 50px">
       <div style="margin-top: 20px">
       <div>
  		<button type="button" class="layui-btn" id="drag1" style="margin: 20px">
            <i class="layui-icon layui-icon-upload"></i> 证件照上传
         </button> 
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                证件照预览图：
    <div class="layui-upload-list" id="upload-demo-preview1" style="display: flex;flex-wrap: wrap;"></div>
    <img src="" alt="" id="preview1" class="layui-upload-img" style="height: 100px"/>
    <input type="hidden" id="previewUrl"/>
<!--       <div>证件照</div>-->
<!--  		 <div class="col-sm-8" >-->
<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;"  id="drag1">-->
<!--                                        <i class="layui-icon" id="icon1"></i>-->
<!--                                            <p id="icontext1">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView1">-->
<!--                                                <hr id="hr1">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img1" name="img1" lay-verify="picture1">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
         </div>
  		<div style="margin-top: 20px">
  		<div>
  		<button type="button" class="layui-btn" id="drag2" style="margin: 20px">
            <i class="layui-icon layui-icon-upload"></i> 身份证上传
         </button> 
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                身份证预览图：
    <div class="layui-upload-list" id="upload-demo-preview2" style="display: flex;flex-wrap: wrap;"></div>
 </blockquote>
<!--  		<div class="col-sm-8" >-->

<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;" id="drag2">-->
<!--                                        <i class="layui-icon" id="icon2"></i>-->
<!--                                            <p id="icontext2">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView2">-->
<!--                                                <hr id="hr2">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img2" name="img2" lay-verify="picture2">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
</div>
  		<div style="margin-top: 20px">
  		<div>
  		<button type="button" class="layui-btn" id="drag3" style="margin: 20px">
            <i class="layui-icon layui-icon-upload"></i> 毕业证上传
         </button> 
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                毕业证预览图：
    <div class="layui-upload-list" id="upload-demo-preview3" style="display: flex;flex-wrap: wrap;"></div>
<!--  		<div>毕业证</div>-->
<!--  		<div class="col-sm-8" >-->
<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px" onclick="upload()">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;"  id="drag3" >-->
<!--                                        <i class="layui-icon" id="icon3"></i>-->
<!--                                            <p id="icontext3">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView3">-->
<!--                                                <hr id="hr3">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img3" name="img3" lay-verify="picture3">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
</div>
</div>
  		<div style="margin: 30px;
    display: flex;
    justify-content: flex-end;">
	<button   onclick="addeditSubmit()"  class="btn btn-primary btn-sm ' + '" href="#" mce_href="#" title="确定" style="background: #337ab7;border-color: #337ab7;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;" >确定</button>
	<button   onclick="handleaddeditClose()"  class="btn  btn-sm ' + '" href="#" mce_href="#" title="取消" style="background: #fff;border-color: #000;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;">取消</i></button>
</div>
    </div>
        `,
        title: dialogTitle,
        closeBtn: 0, // 隐藏右上角关闭按钮
        area: ['1300px', '800px'],
        shadeClose: false, // 禁止点击遮罩关闭
        cancel: function () {
            return false; // 阻止关闭弹窗
        },
        type: 1,
        success() {
            $(document).ready(function () {
                $.ajax({
                    url: "/jzweb/informationBatch/list", // 替换为你的后端接口URL
                    method: "GET",
                    data: {pageNumber: 1, pageSize: 1000}, // 向后端传递姓名参数
                    dataType: "json",
                    success: function (data) {
                        console.log(data.data.records, 'ajax')
                        let declaredCareers = $('#declaredCareers')
                        declaredCareers.append('<option value="">请选择</option>')
                        $.each(data.data.records, function (index, item) {
                            declaredCareers.append('<option value="' + item.profileName + '">' + item.profileName + '</option>');
                        });
                        $('#declaredCareers').val(declaredCareersvalue)
                    },
                })


                $("#declaredCareers").on("change", function () {
                    var selectedCareer = $(this).val(); // 获取选中的职业类别
                    if (selectedCareer) {
                        $.ajax({
                            url: "/jzweb/informationBatch/selInformationBatchs", // 替换为你的后端接口URL，该接口应接受职业类别参数并返回开班时间列表
                            method: "GET",
                            // data: {career: selectedCareer}, // 向后端传递职业类别参数
                            dataType: "json",
                            success: function (data) {
                                // 找到与所选职业匹配的条目
                                var matchedItem = data.data.list.find(item => item.certificateName === selectedCareer);
                                if (matchedItem) {
                                    var openTimes = matchedItem.open_time.split('，'); // 根据逗号分割open_time
                                    var examTimeSelect = $("#examTime");
                                    examTimeSelect.empty(); // 清空原有的选项
                                    examTimeSelect.append('<option value="">请选择</option>'); // 添加默认选项

                                    // 遍历分割后的数组，添加到select中
                                    openTimes.forEach(function (time) {
                                        examTimeSelect.append('<option value="' + time.trim() + '">' + time.trim() + '</option>');
                                    });
                                } else {
                                    var examTimeSelect = $("#examTime");
                                    examTimeSelect.empty(); // 清空原有的选项
                                    examTimeSelect.append('<option value="">请选择</option>');
                                }
                            },
                        })
                    }
                });
                // 姓名手机号关联
                $("#tcname").blur(function () {
                    console.log(11111, '111')
                    var enteredName = $(this).val(); // 获取输入的姓名
                    if (enteredName.trim() !== '') { // 确保姓名不为空
                        $.ajax({
                            url: "/sys/user/list", // 替换为你的后端接口URL
                            method: "GET",
                            data: {username: enteredName}, // 向后端传递姓名参数
                            dataType: "json",
                            success: function (data) {
                                // 请求成功，处理返回的数据
                                var mobileSelect = $("#tcmobile");
                                mobileSelect.empty(); // 清空原有的选项
                                // 遍历返回的手机号码数据，添加到select中
                                mobileSelect.append('<option value="">请选择</option>')
                                $.each(data.data.records, function (index, item) {
                                    mobileSelect.append('<option value="' + item.mobile + '">' + item.mobile + '</option>');
                                });
                            },
                        })
                    }
                })
            });
            layui.use(['upload', 'laydate'], function () {
                var layer = layui.layer;
                var upload = layui.upload;
                var loading;
                var laydate = layui.laydate;
                //执行一个laydate实例
                laydate.render({
                    elem: '#born' //指定元素
                });
                // laydate.render({
                //     elem: '#examTime' //指定元素
                // });
                console.log('2323')
                //拖拽上传
                upload.render({
                    elem: '#drag1'
                    , url: '/common/sysFile/upload' //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
                    // ,field:'picture'
                    ,
                    multiple: true
                    , done: function (res) {
                        if (res.code == '0') { // 假设0为成功
                            $('#preview1').attr('src',res.data)
                            $('#previewUrl').val(res.data)
                            // var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                            //     '<img style="height: 100px" src="' + res.data + '"  class="layui-upload-img preview-img"/>' +
                            //     '<span class="demo-delete" style="color: #f00;position: absolute;left: 88%;font-size: 30px; cursor: pointer;" data-id="' + res.data + '">×</span></div>';
                            // $('#upload-demo-preview1').append(imgHtml);
                            // // 将返回的数据存储起来，比如存入一个数组
                            // zjzuploadedImages.push(res.data)

                            // $('.layui-upload-img').off('click').on('click', function(){
                            //     var imgSrc = $(this).attr('src');
                            //     showImagePreview(imgSrc);
                            // });
                            // // 绑定删除图标点击事件
                            // $('#upload-demo-preview1').off('click', '.demo-delete').on('click', '.demo-delete', function () {
                            //     $(this).closest('.upload-demo').remove();
                            //     let objId = $(this).attr('data-id');
                            //     console.log(objId, '000')
                            //     deleteImage(zjzuploadedImages, objId)
                            // });

                        }
                    },

                });
                upload.render({
                    elem: '#drag2'
                    , url: '/common/sysFile/upload', //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
                    // ,field:'picture'
                    multiple: true
                    , done: function (res) {
                        console.log(res)
                        if (res.code == '0') { // 假设0为成功
                            var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                                '<img style="height: 100px" src="' + res.data + '"  class="layui-upload-img preview-img"/>' +
                                '<span class="demo-delete" style="color: #f00;position: absolute;left: 88%;font-size: 30px; cursor: pointer;" data-id="' + res.data + '">×</span></div>';
                            $('#upload-demo-preview2').append(imgHtml);
                            // 将返回的数据存储起来，比如存入一个数组
                            sfzuploadedImages.push(res.data)
                            $('.layui-upload-img').off('click').on('click', function(){
                                var imgSrc = $(this).attr('src');
                                showImagePreview(imgSrc);
                            });
                            // 绑定删除图标点击事件
                            $('#upload-demo-preview2').off('click', '.demo-delete').on('click', '.demo-delete', function () {
                                $(this).closest('.upload-demo').remove();
                                let objId = $(this).attr('data-id');
                                console.log(objId, '000')
                                deleteImage(sfzuploadedImages, objId)
                            });
                            ;
                        }
                    },

                });
                upload.render({
                    elem: '#drag3'
                    , url: '/common/sysFile/upload', //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
                    // ,field:'picture'
                    multiple: true

                    , done: function (res) {
                        if (res.code == '0') { // 假设0为成功
                            var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                                '<img style="height: 100px" src="' + res.data + '"  class="layui-upload-img preview-img"/>' +
                                '<span class="demo-delete" style="color: #f00;position: absolute;left: 88%;font-size: 30px; cursor: pointer;" data-id="' + res.data + '">×</span></div>';
                            $('#upload-demo-preview3').append(imgHtml);
                            // 将返回的数据存储起来，比如存入一个数组
                            byzuploadedImages.push(res.data)

                            $('.layui-upload-img').off('click').on('click', function(){
                                var imgSrc = $(this).attr('src');
                                showImagePreview(imgSrc);
                            });

                            // 绑定删除图标点击事件
                            $('#upload-demo-preview3').off('click', '.demo-delete').on('click', '.demo-delete', function () {
                                $(this).closest('.upload-demo').remove();
                                let objId = $(this).attr('data-id');
                                console.log(objId, '000')
                                deleteImage(byzuploadedImages, objId)
                            });
                            ;
                        }
                    },

                });
            });
        }
    });
}

function deleteImage(arr, imageUrl) {
    console.log([imageUrl])
    // 根据id从数组中移除相应的记录
    for (let i = 0; i < arr.length; i++) {
        if (arr[i] === imageUrl) {
            arr.splice(i, 1);
            console.log("Deleted item:", imageUrl);
            console.log(arr)
        }
    }
}

function handleaddeditClose() {
    layer.close(index1)
    reLoad();
}

var shenheid = ''
var index2 = ''

function shenHe(id) {
    // var bookList = [{id: 0, name: '1'}, {id: 1, name: '111'}, {id: 2, name: '12222'}];
    // var workList = [{id: 0, name: '1'}, {id: 1, name: '111'}, {id: 2, name: '12222'}];
    shenheid = id
    index2 = layer.open({
        content: `
          <div >
          <div class="title">基础信息</div>
           <div class="form-box" >
               <label>姓名：</label>
               <div class="layui-input-inline">
                  <input id="tcname" name="name" disabled type="text" required lay-verify="required" class="form-control" placeholder="请输入姓名">
               </div>
               <label>联系方式：</label>
               <div class="layui-input-inline">
                  <input id="tcmobile" name="mobile" disabled type="text" required lay-verify="required" class="form-control" placeholder="请输入联系方式">
               </div>
               <label>性别：</label>
               <div class="layui-input-inline">
               <select id="sex" disabled style="width: 196px" class="form-control" name="sex"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择性别">
                                <option value="">请选择</option>
                               <option value="1">男</option>
                               <option value="2">女</option>
                            </select>
<!--                  <input id="sex" name="sex"  type="text" required lay-verify="required"  >-->
               </div>
               <label>出生年月：</label>
               <div class="layui-input-inline">
               <input id="born" disabled style="width:200px" name="born" class="form-control" type="text" placeholder="请输入出生年月">
<!--                  <input id="born" name="born" type="text" required lay-verify="required" class="form-control" placeholder="请输入出生年月">-->
               </div>
           </div>
           <div class="form-box" >
               <label>学历：</label>
               <div class="layui-input-inline">
               <select id="education" disabled style="width: 196px" class="form-control" name="education"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择学历">
                               <option value="">请选择</option>
                               <option value="1">初中</option>
                               <option value="2">高中</option>
                               <option value="3">中专</option>
                               <option value="4">大专</option>
                               <option value="5">大学</option>
                               <option value="6">硕士</option>
                               <option value="7">博士</option>
                            </select>
<!--                  <input id="education" name="education"  type="text" required lay-verify="required" class="form-control" placeholder="请输入学历">-->
               </div>
               <label>所学专业：</label>
               <div class="layui-input-inline">
                  <input id="major" disabled name="major"  type="text" required lay-verify="required" class="form-control" placeholder="请输入所学专业">
               </div>
               <label>人员类别：</label>
               <div class="layui-input-inline">
               <select id="tcpersonType" disabled style="width: 196px" class="form-control" name="personType"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
                              <option value="">请选择</option>
                               <option value="0">学生</option>
                               <option value="1">企业员工</option>
                               <option value="2">社会人员</option>
                            </select>
<!--                  <input id="personType" name="personType" type="text" required lay-verify="required" class="form-control" placeholder="请输入人员类型">-->
               </div>
               <label>证件类型：</label>
               <div class="layui-input-inline">
                  <input disabled value="身份证"disabled  type="text" required lay-verify="required" class="form-control" >
               </div>
           </div>
           <div class="form-box" >
               <label>身份证地址：</label>
               <div class="layui-input-inline">
                  <input id="idcardAddress"disabled name="idcardAddress"  type="text" required lay-verify="required" class="form-control" placeholder="请输入身份证地址">
               </div>
               <label>身份证号：</label>
               <div class="layui-input-inline">
                  <input id="idcardNumber"disabled name="idcardNumber"  type="text" required lay-verify="required" class="form-control" placeholder="请输入身份证号">
               </div>
               <label>工作单位：</label>
               <div class="layui-input-inline">
                  <input id="workUnit" name="workUnit" disabled type="text" required lay-verify="required" class="form-control" placeholder="请输入工作单位">
               </div>
               <label>职业年限：</label>
               <div class="layui-input-inline">
                  <input disabled id="workTime" type="text" disabled required lay-verify="required" class="form-control" placeholder="无需填写">
               </div>
           </div>
           
        </div>
        <div>
        <div class="title">申报信息</div>
         <div class="form-box" >
               <label>申报职业：</label>
               <div class="layui-input-inline">
               <select id="declaredCareers" style="width: 196px" disabled class="form-control" name="declaredCareers"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
<!--                              <option value="">请选择</option>-->
<!--                               <option value="育婴师">育婴师</option>-->
<!--                               <option value="保育师">保育师</option>-->
<!--                               <option value="养老护理员">养老护理员</option>-->
                            </select>
<!--                  <input id="declaredCareers" name="declaredCareers" type="text" required lay-verify="required" class="form-control" placeholder="请输入申报职业">-->
               </div>
               <label>开班时间：</label>
               <div class="layui-input-inline">
                  <input id="examTime" name="examTime" disabled  type="text" required lay-verify="required" class="form-control" placeholder="请输入开班时间">
               </div>
               <label>申报等级：</label>
               <div class="layui-input-inline">
               <select id="declaredLevel" style="width: 196px" disabled class="form-control" name="declaredLevel"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
                              <option value="">请选择</option>
                               <option value="三级">三级</option>
                               <option value="四级">四级</option>
                               <option value="五级">五级</option>
                            </select>
<!--                  <input id="declaredLevel" name="declaredLevel"  type="text" required lay-verify="required" class="form-control" placeholder="请输入申报等级">-->
               </div>
               <label>申报科目：</label>
               <div class="layui-input-inline">
               <input name="select_item" type="checkbox" value="0" style="margin-right: 10px;" disabled><span style="margin-top: 4px" >理论</span>
               <input name="select_item" type="checkbox" value="1" style="margin-right: 10px" disabled><span  style="margin-top: 4px" >实操</span>
               <input name="select_item" type="checkbox" value="2" style="margin-right: 10px" disabled><span  style="margin-top: 4px" >综合</span>
<!--               <select id="declaredSubject" style="width: 196px" disabled class="form-control" name="declaredSubject"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">-->
<!--                            <option value="">请选择</option>-->
<!--                               <option value="0">理论</option>-->
<!--                               <option value="1">实操</option>-->
<!--                               <option value="2">综合</option>-->
<!--                            </select>-->
<!--                  <input id="declaredSubject" name="declaredSubject"  type="text" required lay-verify="required" class="form-control" placeholder="请输入申报科目">-->
               </div>
           </div>
         </div>
         <div>
         <div class="title" >证书信息</div>
   
        <div style="margin:20px 0px 20px 80px;">
        <div class="btitle"></div>
        <div style="display:flex;margin-left: 60px">
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center;">职业（工作）</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center;">等级</div>
<!--        <div style="padding: 10px;background: #eee;width: 150px">证书</div>-->
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center;">签证日期</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center;">证书图片</div>
       </div>
       <div id="list" style="margin-left: 60px;"></div>
       </div>
       <div style="margin-left: 10px">工作经历</div>
     
        <div style="margin:20px 0px 20px 80px;">
        <div class="btitle"></div>
        <div style="display:flex;margin-left: 60px">
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">起止年月</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center">工作单位</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">工作岗位</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">单位联系人</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center">联系电话</div>
       </div>
       <div>
       <div id="worklist" style="margin-left: 60px;"></div>
</div>
</div>
       <div class="title" style="margin: 20px 0px;margin-left: 10px">证件信息</div>
       <div style="style="display: flex;justify-content: space-around;flex-direction: column;padding-left: 50px"">
       <div style="margin-top: 20px">
       <div>
<!--  		<button type="button" class="layui-btn" id="drag1" style="margin: 20px">-->
<!--            <i class="layui-icon layui-icon-upload"></i> 证件照上传-->
<!--         </button> -->
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                证件照预览图：
    <div class="layui-upload-list" id="upload-demo-preview1" style="display: flex;flex-wrap: wrap;"></div>
<!--       <div>证件照</div>-->
<!--  		 <div class="col-sm-8" >-->
<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;"  id="drag1">-->
<!--                                        <i class="layui-icon" id="icon1"></i>-->
<!--                                            <p id="icontext1">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView1">-->
<!--                                                <hr id="hr1">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img1" name="img1" lay-verify="picture1">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
         </div>
  		<div style="margin-top: 20px">
  		<div>
<!--  		<button type="button" class="layui-btn" id="drag2" style="margin: 20px">-->
<!--            <i class="layui-icon layui-icon-upload"></i> 身份证上传-->
<!--         </button> -->
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                身份证预览图：
    <div class="layui-upload-list" id="upload-demo-preview2" style="display: flex;flex-wrap: wrap;"></div>
 </blockquote>
<!--  		<div class="col-sm-8" >-->

<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;" id="drag2">-->
<!--                                        <i class="layui-icon" id="icon2"></i>-->
<!--                                            <p id="icontext2">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView2">-->
<!--                                                <hr id="hr2">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img2" name="img2" lay-verify="picture2">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
</div>
  		<div style="margin-top: 20px">
  		<div>
<!--  		<button type="button" class="layui-btn" id="drag3" style="margin: 20px">-->
<!--            <i class="layui-icon layui-icon-upload"></i> 毕业证或社保证明上传-->
<!--         </button> -->
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                毕业证或社保证明预览图：
    <div class="layui-upload-list" id="upload-demo-preview3" style="display: flex;flex-wrap: wrap;"></div>
<!--  		<div>毕业证</div>-->
<!--  		<div class="col-sm-8" >-->
<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px" onclick="upload()">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;"  id="drag3" >-->
<!--                                        <i class="layui-icon" id="icon3"></i>-->
<!--                                            <p id="icontext3">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView3">-->
<!--                                                <hr id="hr3">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img3" name="img3" lay-verify="picture3">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
</div>
</div>
            <div>
            <div id="radiobox" style="margin-left: 60px;
            margin-top: 30px;
    width: 300px;
    display: flex;align-items: center" >
            <input type="radio" name="auditStatus" style="width: 45px;
    height: 20px;" value="1" id="auditYes" "><span style="width: 200px;margin: 0px 10px;"> 同意</span>
<label for="auditYes"></label>
<input type="radio" name="auditStatus" value="2" id="auditNo" style="width: 45px;
    height: 20px;"><span style="width: 200px;margin: 0px 10px;"> 拒绝</span> 
<label for="auditNo"></label>
            </div>
            <div>
            <textarea  placeholder="请输入拒绝原因" class="layui-textarea" id="reason"  style="width: 300px; display: none;
    margin: 10px 0px 0px 26px;"></textarea>
</div>
</div>
<div style="margin: 30px;
    display: flex;
    justify-content: flex-end;">
	<button   onclick="handleShenheSubmit()"  class="btn btn-primary btn-sm ' + '" href="#" mce_href="#" title="确定" style="background: #337ab7;border-color: #337ab7;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;" >确定</button>
	<button   onclick="handleClose()"  class="btn  btn-sm ' + '" href="#" mce_href="#" title="取消" style="background: #fff;border-color: #000;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;">取消</i></button>
</div>
</div>
    </div>
        `,
        title: '审核',
        closeBtn: 0, // 隐藏右上角关闭按钮
        area: ['1300px', '800px'],
        shadeClose: false, // 禁止点击遮罩关闭
        // cancel: function () {
        // 	return false; // 阻止关闭弹窗
        // },
        type: 1,
        success() {
            let declaredCareersvalue=''

            selectedValue = ''
            $.ajax({
                type: 'GET',
                data: {
                    id: id
                },
                url: '/jzweb/informationImportUser/getInfo',
                success: function (r) {
                    selectedValues = r.data.declaredSubject.split(',')
                    $("input[type='checkbox']").each(function () {
                        // 如果当前复选框的值在selectedValues数组中，则设置为选中状态
                        if ($.inArray($(this).val(), selectedValues) !== -1) {
                            $(this).prop("checked", true);
                        } else {
                            $(this).prop("checked", false);
                        }
                    });
                    $('#tcname').val(r.data.name)
                    $('#tcmobile').val(r.data.mobile)
                    $('#sex').val(r.data.sex)
                    $('#born').val(r.data.born)
                    $('#education').val(r.data.education)
                    $('#major').val(r.data.major)
                    $('#tcpersonType').val(r.data.personType)
                    $('#idcardAddress').val(r.data.idcardAddress)
                    $('#idcardNumber').val(r.data.idcardNumber)
                    $('#workUnit').val(r.data.workUnit)
                    $('#examTime').val(r.data.examTime)
                    declaredCareersvalue=r.data.declaredCareers
                    $.ajax({
                        url: "/jzweb/informationBatch/list", // 替换为你的后端接口URL
                        method: "GET",
                        data: {pageNumber: 1, pageSize: 1000}, // 向后端传递姓名参数
                        dataType: "json",
                        success: function (data) {
                            console.log(data.data.records, 'ajax')
                            let declaredCareers = $('#declaredCareers')
                            declaredCareers.append('<option value="">请选择</option>')
                            $.each(data.data.records, function (index, item) {
                                declaredCareers.append('<option value="' + item.profileName + '">' + item.profileName + '</option>');
                            });
                            $('#declaredCareers').val(declaredCareersvalue)
                        },
                    })

                    $('#declaredCareers').val(r.data.declaredCareers)
                    $('#declaredLevel').val(r.data.declaredLevel)
                    $('#declaredSubject').val(r.data.declaredSubject)
                    $('#workTime').val(r.data.workTime)

                    let imgurl1 = r.data.personPhoto
                    let imgurl2 = JSON.parse(r.data.idcardPhoto)
                    let imgurl3 = JSON.parse(r.data.graducationPhoto)
                    console.log(imgurl1, imgurl2, imgurl3)
                        var imgHtml1 = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                            '<img style="height: 100px" src="' + imgurl1 + '" class="layui-upload-img preview-img"/></div>';
                        $('#upload-demo-preview1').append(imgHtml1);
                    // imgurl1.forEach(function (item) {
                    //     var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                    //         '<img style="height: 100px" src="' + item + '" class="layui-upload-img preview-img"/></div>';
                    //     $('#upload-demo-preview1').append(imgHtml);
                    // });

                    imgurl2.forEach(function (item) {
                        var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                            '<img style="height: 100px" src="' + item + '" class="layui-upload-img preview-img"/></div>';
                        $('#upload-demo-preview2').append(imgHtml);
                    });

                    imgurl3.forEach(function (item) {
                        var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                            '<img style="height: 100px" src="' + item + '" class="layui-upload-img preview-img"/></div>';
                        $('#upload-demo-preview3').append(imgHtml);
                    });
                    $('.preview-img').off('click').on('click', function(){
                        var imgSrc = $(this).attr('src');
                        showImagePreview(imgSrc);
                    });

                    // 使用$.each遍历JSON数据
                    $.each(r.data.certificateInfoVos, function (index, item) {
                        var listItem = $('<div >');
                        var photo = $('<img src="' + item.photo + '" style="margin: 10px 27px;;width: 100px;display: inline-block;">');
                        var certificateTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.certificateTime);
                        var level = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.level);
                        var career = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.career);
                        var deleteButton = $('<button>', {
                            class: 'deleteButton',
                            text: '删除'
                        });

                        // 绑定删除按钮的点击事件
                        deleteButton.click(function (event) {
                            layer.confirm('确定要删除该信息？', {
                                btn: ['确定', '取消']
                            }, function () {
                                console.log(item)
                                // 删除接口
                                event.preventDefault(); // 阻止默认行为，如链接跳转
                                listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                                layer.msg('删除成功');
                            })
                        });
                        // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
                        listItem.append(career).append(level).append(certificateTime).append(photo);
                        $('#list').append(listItem);
                    });
                    $.each(r.data.experinceVos, function (index, item) {
                        var listItem = $('<div >');
                        var contactMobile = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.contactMobile);
                        var contact = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.contact);
                        var job = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.job);
                        var workUnit = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.workUnit);
                        var startTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.startTime + '-' + item.endTime);
                        var deleteButton = $('<button style="">', {
                            class: 'deleteButton',
                            text: '删除'
                        });

                        // 绑定删除按钮的点击事件
                        deleteButton.click(function (event) {
                            layer.confirm('确定要删除该信息？', {
                                btn: ['确定', '取消']
                            }, function () {
                                console.log(item)
                                editworklist[index].isDelete = '1'
                                lookeditworklist[index].isDelete = '1'
                                lookeditworklist.splice(index, 1)
                                // 删除接口
                                event.preventDefault(); // 阻止默认行为，如链接跳转
                                listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                                layer.msg('删除成功');
                            })

                        });
                        // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
                        listItem.append(startTime).append(workUnit).append(job).append(contact).append(contactMobile);
                        $('#worklist').append(listItem);
                    });
                    $.ajax({
                        url: "/jzweb/informationBatch/list", // 替换为你的后端接口URL
                        method: "GET",
                        data: {pageNumber: 1, pageSize: 1000}, // 向后端传递姓名参数
                        dataType: "json",
                        success: function (data) {
                            console.log(data.data.records, 'ajax')
                            let declaredCareers = $('#declaredCareers')
                            declaredCareers.append('<option value="">请选择</option>')
                            $.each(data.data.records, function (index, item) {
                                declaredCareers.append('<option value="' + item.profileName + '">' + item.profileName + '</option>');
                            });
                            $('#declaredCareers').val(declaredCareersvalue)
                        },
                    })
                }
            })
            // var bookList = [{id: 0, name: '1'}, {id: 1, name: '111'}, {id: 2, name: '12222'}];
            // var workList = [{id: 0, name: '1'}, {id: 1, name: '111'}, {id: 2, name: '12222'}];
            $('input[name="auditStatus"]').on('change', function () {
                // 获取当前选中单选框的值
                selectedValue = $(this).val();
                if (selectedValue == '2') {
                    $('#reason').show()
                } else {
                    $('#reason').hide()
                }
                console.log()
            });
            // 模拟的JSON数据，实际项目中这应该是通过Ajax从服务器获取的


        }
    });
}
function showImagePreview(src) {
    var layer = $('<div class="preview-layer"><img src="'+ src +'" /></div>');
    $('body').append(layer);
    layer.fadeIn();

    // 关闭预览的事件处理
    layer.click(function(e) {
        if (e.target.className !== 'preview-layer img') {
            layer.fadeOut(function() {
                layer.remove();
            });
        }
    });
}
function xiangQing(id) {
    shenheid = id
    index2 = layer.open({
        content: `
          <div >
          <div class="title">基础信息</div>
           <div class="form-box" >
               <label>姓名：</label>
               <div class="layui-input-inline">
                  <input id="tcname" name="name" disabled type="text" required lay-verify="required" class="form-control" placeholder="请输入姓名">
               </div>
               <label>联系方式：</label>
               <div class="layui-input-inline">
                  <input id="tcmobile" name="mobile" disabled type="text" required lay-verify="required" class="form-control" placeholder="请输入联系方式">
               </div>
               <label>性别：</label>
               <div class="layui-input-inline">
               <select id="sex" disabled style="width: 196px" class="form-control" name="sex"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择性别">
                                <option value="">请选择</option>
                               <option value="1">男</option>
                               <option value="2">女</option>
                            </select>
<!--                  <input id="sex" name="sex"  type="text" required lay-verify="required"  >-->
               </div>
               <label>出生年月：</label>
               <div class="layui-input-inline">
               <input id="born" disabled style="width:200px" name="born" class="form-control" type="text" placeholder="请输入出生年月">
<!--                  <input id="born" name="born" type="text" required lay-verify="required" class="form-control" placeholder="请输入出生年月">-->
               </div>
           </div>
           <div class="form-box" >
               <label>学历：</label>
               <div class="layui-input-inline">
               <select id="education" disabled style="width: 196px" class="form-control" name="education"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择学历">
                               <option value="">请选择</option>
                               <option value="1">初中</option>
                               <option value="2">高中</option>
                               <option value="3">中专</option>
                               <option value="4">大专</option>
                               <option value="5">大学</option>
                               <option value="6">硕士</option>
                               <option value="7">博士</option>
                            </select>
<!--                  <input id="education" name="education"  type="text" required lay-verify="required" class="form-control" placeholder="请输入学历">-->
               </div>
               <label>所学专业：</label>
               <div class="layui-input-inline">
                  <input id="major" disabled name="major"  type="text" required lay-verify="required" class="form-control" placeholder="请输入所学专业">
               </div>
               <label>人员类别：</label>
               <div class="layui-input-inline">
               <select id="tcpersonType" disabled style="width: 196px" class="form-control" name="personType"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
                              <option value="">请选择</option>
                               <option value="0">学生</option>
                               <option value="1">企业员工</option>
                               <option value="2">社会人员</option>
                            </select>
<!--                  <input id="personType" name="personType" type="text" required lay-verify="required" class="form-control" placeholder="请输入人员类型">-->
               </div>
               <label>身份证：</label>
               <div class="layui-input-inline">
                  <input disabled value="身份证"disabled  type="text" required lay-verify="required" class="form-control" >
               </div>
           </div>
           <div class="form-box" >
               <label>身份证地址：</label>
               <div class="layui-input-inline">
                  <input id="idcardAddress"disabled name="idcardAddress"  type="text" required lay-verify="required" class="form-control" placeholder="请输入身份证地址">
               </div>
               <label>身份证号：</label>
               <div class="layui-input-inline">
                  <input id="idcardNumber"disabled name="idcardNumber"  type="text" required lay-verify="required" class="form-control" placeholder="请输入身份证号">
               </div>
               <label>工作单位：</label>
               <div class="layui-input-inline">
                  <input id="workUnit" name="workUnit" disabled type="text" required lay-verify="required" class="form-control" placeholder="请输入工作单位">
               </div>
               <label>职业年限：</label>
               <div class="layui-input-inline">
                  <input disabled id="workTime" type="text" disabled required lay-verify="required" class="form-control" placeholder="无需填写">
               </div>
           </div>
         
        </div>
        <div>
        <div class="title">申报信息</div>
         <div class="form-box" >
               <label>申报职业：</label>
               <div class="layui-input-inline">
               <select id="declaredCareers" style="width: 196px" disabled class="form-control" name="declaredCareers"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
<!--                              <option value="">请选择</option>-->
<!--                               <option value="育婴师">育婴师</option>-->
<!--                               <option value="保育师">保育师</option>-->
<!--                               <option value="养老护理员">养老护理员</option>-->
                            </select>
<!--                  <input id="declaredCareers" name="declaredCareers" type="text" required lay-verify="required" class="form-control" placeholder="请输入申报职业">-->
               </div>
               <label>开班时间：</label>
               <div class="layui-input-inline">
                  <input id="examTime" name="examTime" disabled  type="text" required lay-verify="required" class="form-control" placeholder="请输入开班时间">
               </div>
               <label>申报等级：</label>
               <div class="layui-input-inline">
               <select id="declaredLevel" style="width: 196px" disabled class="form-control" name="declaredLevel"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">
                              <option value="">请选择</option>
                               <option value="三级">三级</option>
                               <option value="四级">四级</option>
                               <option value="五级">五级</option>
                            </select>
<!--                  <input id="declaredLevel" name="declaredLevel"  type="text" required lay-verify="required" class="form-control" placeholder="请输入申报等级">-->
               </div>
               <label>申报科目：</label>
               <div class="layui-input-inline">
               <input name="select_item" type="checkbox" value="0" style="margin-right: 10px;" disabled><span style="margin-top: 4px" >理论</span>
               <input name="select_item" type="checkbox" value="1" style="margin-right: 10px" disabled><span  style="margin-top: 4px" >实操</span>
               <input name="select_item" type="checkbox" value="2" style="margin-right: 10px" disabled><span  style="margin-top: 4px" >综合</span>
<!--               <select id="declaredSubject" style="width: 196px" disabled class="form-control" name="declaredSubject"  lay-search="" required lay-verify="required" lay-filter="select-filter" placeholder="请选择人员类别">-->
<!--                            <option value="">请选择</option>-->
<!--                               <option value="0">理论</option>-->
<!--                               <option value="1">实操</option>-->
<!--                               <option value="2">综合</option>-->
<!--                            </select>-->
<!--                  <input id="declaredSubject" name="declaredSubject"  type="text" required lay-verify="required" class="form-control" placeholder="请输入申报科目">-->
               </div>
           </div>
         </div>
         <div>
         <div class="title">证书信息</div>
   
        <div>
        <div class="btitle"></div>
        <div style="display:flex;margin-left: 60px">
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center;">职业（工作）</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center;">等级</div>
<!--        <div style="padding: 10px;background: #eee;width: 150px">证书</div>-->
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center;">签证日期</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center;">证书图片</div>
       </div>
       <div id="list" style="margin-left: 60px;"></div>
       <div class="title" style="padding: 20px 0px">工作经历</div>
     
        <div>
        <div class="btitle"></div>
        <div style="display:flex;margin-left: 60px">
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">起止年月</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center">工作单位</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">工作岗位</div>
        <div style="padding: 10px;background: #eee;width: 150px;text-align: center">单位联系人</div>
        <div style="padding: 10px;background:#eee;width: 150px;text-align: center">联系电话</div>
       </div>
       <div>
       <div id="worklist" style="margin-left: 60px;"></div>
</div>
       <div class="title" style="padding: 20px 0px">证件信息</div>
       <div style="display: flex;justify-content: space-around;flex-direction: column;padding-left: 50px">
       <div style="margin-top: 20px">
       <div>
<!--  		<button type="button" class="layui-btn" id="drag1" style="margin: 20px">-->
<!--            <i class="layui-icon layui-icon-upload"></i> 证件照上传-->
<!--         </button> -->
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                证件照预览图：
    <div class="layui-upload-list" id="upload-demo-preview1" style="display: flex;flex-wrap: wrap;"></div>
<!--       <div>证件照</div>-->
<!--  		 <div class="col-sm-8" >-->
<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;"  id="drag1">-->
<!--                                        <i class="layui-icon" id="icon1"></i>-->
<!--                                            <p id="icontext1">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView1">-->
<!--                                                <hr id="hr1">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img1" name="img1" lay-verify="picture1">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
         </div>
  		<div style="margin-top: 20px">
  		<div>
<!--  		<button type="button" class="layui-btn" id="drag2" style="margin: 20px">-->
<!--            <i class="layui-icon layui-icon-upload"></i> 身份证上传-->
<!--         </button> -->
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                身份证预览图：
    <div class="layui-upload-list" id="upload-demo-preview2" style="display: flex;flex-wrap: wrap;"></div>
 </blockquote>
<!--  		<div class="col-sm-8" >-->

<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;" id="drag2">-->
<!--                                        <i class="layui-icon" id="icon2"></i>-->
<!--                                            <p id="icontext2">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView2">-->
<!--                                                <hr id="hr2">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img2" name="img2" lay-verify="picture2">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
</div>
  		<div style="margin-top: 20px">
  		<div>
<!--  		<button type="button" class="layui-btn" id="drag3" style="margin: 20px">-->
<!--            <i class="layui-icon layui-icon-upload"></i> 毕业证上传-->
<!--         </button> -->
         </div>
  		<blockquote class="layui-elem-quote layui-quote-nm" style="border: none;">
                毕业证预览图：
    <div class="layui-upload-list" id="upload-demo-preview3" style="display: flex;flex-wrap: wrap;"></div>
<!--  		<div>毕业证</div>-->
<!--  		<div class="col-sm-8" >-->
<!--                                <div >-->
<!--                                    <div class="layui-input-block" style="margin: 0px" onclick="upload()">-->
<!--                                        <div class="layui-upload-drag" style="width: 300px;min-height: 150px;"  id="drag3" >-->
<!--                                        <i class="layui-icon" id="icon3"></i>-->
<!--                                            <p id="icontext3">点击上传，或将文件拖拽到此处</p>-->
<!--                                            <div class="layui-hide" id="uploadDemoView3">-->
<!--                                                <hr id="hr3">-->
<!--                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                        <input type="hidden" id="img3" name="img3" lay-verify="picture3">-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
</div>
</div>
       
            <div>
            <span id="reasontitle" style="display: none">拒绝原因：</span>
            <textarea disabled placeholder="请输入拒绝原因" class="layui-textarea" id="reason"  style="width: 300px; display: none;
    margin: 10px 0px 0px 26px;"></textarea>
</div>
</div>
<div style="margin: 30px;
    display: flex;
    justify-content: flex-end;">
	
	<button   onclick="handleClose()"  class="btn  btn-sm ' + '" href="#" mce_href="#" title="取消" style="background: #fff;border-color: #000;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;">取消</i></button>
</div>
</div>
    </div>
        `,
        title: '详情',
        closeBtn: 0, // 隐藏右上角关闭按钮
        area: ['1300px', '800px'],
        shadeClose: false, // 禁止点击遮罩关闭
        // cancel: function () {
        // 	return false; // 阻止关闭弹窗
        // },
        type: 1,
        success() {
 let declaredCareersvalue=''
            $.ajax({
                type: 'GET',
                data: {
                    id: id
                },
                url: '/jzweb/informationImportUser/getInfo',
                success: function (r) {
                    selectedValues = r.data.declaredSubject.split(',')
                    $("input[type='checkbox']").each(function () {
                        // 如果当前复选框的值在selectedValues数组中，则设置为选中状态
                        if ($.inArray($(this).val(), selectedValues) !== -1) {
                            $(this).prop("checked", true);
                        } else {
                            $(this).prop("checked", false);
                        }
                    });
                    $('#tcname').val(r.data.name)
                    $('#tcmobile').val(r.data.mobile)
                    $('#sex').val(r.data.sex)
                    $('#born').val(r.data.born)
                    $('#education').val(r.data.education)
                    $('#major').val(r.data.major)
                    $('#tcpersonType').val(r.data.personType)
                    $('#idcardAddress').val(r.data.idcardAddress)
                    $('#idcardNumber').val(r.data.idcardNumber)
                    $('#workUnit').val(r.data.workUnit)
                    $('#examTime').val(r.data.examTime)
                    declaredCareersvalue=r.data.declaredCareers
                    $('#declaredCareers').val(r.data.declaredCareers)
                    $('#declaredLevel').val(r.data.declaredLevel)
                    $('#declaredSubject').val(r.data.declaredSubject)
                    $('#workTime').val(r.data.workTime)
                    $('#reason').val(r.data.reason)

                    if (r.data.checkStatus == '2') {
                        $('#reason').show()
                        $('#reasontitle').show()
                    }
                    let imgurl1 = r.data.personPhoto
                    let imgurl2 = JSON.parse(r.data.idcardPhoto)
                    let imgurl3 = JSON.parse(r.data.graducationPhoto)
                    console.log(imgurl1, imgurl2, imgurl3)
                    var imgHtml1 = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                        '<img style="height: 100px" src="' + imgurl1 + '" class="layui-upload-img preview-img"/></div>';
                    $('#upload-demo-preview1').append(imgHtml1);

                    imgurl2.forEach(function (item) {
                        var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                            '<img style="height: 100px" src="' + item + '" class="layui-upload-img preview-img"/></div>';
                        $('#upload-demo-preview2').append(imgHtml);
                    });

                    imgurl3.forEach(function (item) {
                        var imgHtml = '<div class="upload-demo" style="position: relative;margin-right: 10px;margin-top: 10px">' +
                            '<img style="height: 100px" src="' + item + '" class="layui-upload-img preview-img"/></div>';
                        $('#upload-demo-preview3').append(imgHtml);
                    });
                    $('.preview-img').off('click').on('click', function(){
                        var imgSrc = $(this).attr('src');
                        showImagePreview(imgSrc);
                    });
                    // 使用$.each遍历JSON数据
                    $.each(r.data.certificateInfoVos, function (index, item) {
                        var listItem = $('<div >');
                        var photo = $('<img src="' + item.photo + '" style="margin: 10px 56px;;;width: 80px;display: inline-block;">');
                        var certificateTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.certificateTime);
                        var level = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.level);
                        var career = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.career);
                        var deleteButton = $('<button style="margin-left: 20px">', {
                            class: 'deleteButton',
                            text: '删除'
                        });

                        // 绑定删除按钮的点击事件
                        deleteButton.click(function (event) {
                            layer.confirm('确定要删除该信息？', {
                                btn: ['确定', '取消']
                            }, function () {
                                console.log(item)
                                // 删除接口
                                event.preventDefault(); // 阻止默认行为，如链接跳转
                                listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                                layer.msg('删除成功');
                            })
                        });
                        // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
                        listItem.append(career).append(level).append(certificateTime).append(photo);
                        $('#list').append(listItem);
                    });
                    $.each(r.data.experinceVos, function (index, item) {
                        var listItem = $('<div >');
                        var contactMobile = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.contactMobile);
                        var contact = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.contact);
                        var job = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.job);
                        var workUnit = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.workUnit);
                        var startTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.startTime + '-' + item.endTime);
                        var deleteButton = $('<button>', {
                            class: 'deleteButton',
                            text: '删除'
                        });

                        // 绑定删除按钮的点击事件
                        deleteButton.click(function (event) {
                            layer.confirm('确定要删除该信息？', {
                                btn: ['确定', '取消']
                            }, function () {

                                console.log(item)
                                // 删除接口
                                event.preventDefault(); // 阻止默认行为，如链接跳转
                                listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                                layer.msg('删除成功');
                            })
                        });
                        // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
                        listItem.append(startTime).append(workUnit).append(job).append(contact).append(contactMobile);
                        $('#worklist').append(listItem);
                    });
                }
            })
            // var bookList = [{id: 0, name: '1'}, {id: 1, name: '111'}, {id: 2, name: '12222'}];
            // var workList = [{id: 0, name: '1'}, {id: 1, name: '111'}, {id: 2, name: '12222'}];
            // 模拟的JSON数据，实际项目中这应该是通过Ajax从服务器获取的
            $.ajax({
                url: "/jzweb/informationBatch/list", // 替换为你的后端接口URL
                method: "GET",
                data: {pageNumber: 1, pageSize: 1000}, // 向后端传递姓名参数
                dataType: "json",
                success: function (data) {
                    console.log(data.data.records, 'ajax')
                    let declaredCareers = $('#declaredCareers')
                    declaredCareers.append('<option value="">请选择</option>')
                    $.each(data.data.records, function (index, item) {
                        declaredCareers.append('<option value="' + item.profileName + '">' + item.profileName + '</option>');
                    });
                    $('#declaredCareers').val(declaredCareersvalue)
                },
            })

        }
    });
}

function handleClose() {
    layer.close(index2)
    reLoad();
}

function handleShenheSubmit() {
    if (selectedValue) {
        $.ajax({
            type: 'GET',
            data: {
                id: shenheid,
                state: selectedValue,
                reason: $('#reason').val(),
            },
            url: '/jzweb/informationImportUser/checkImportUser',
            success: function (r) {
                console.log(r.code)
                if (r.code == '0') {
                    layer.msg(r.msg);
                    layer.close(index2)
                    reLoad();
                }
            }
        })
    } else {
        layer.msg('请选择审核结果！')
    }

}

function handleShenhe() {
    console.log($("[name='auditStatus']").val())
}

var index3 = ''
var index4 = ''

function addworklist() {
    index4 = layer.open({
        type: 1,
        title: '添加工作经历',
        shadeClose: false, // 同样禁止点击遮罩关闭
        closeBtn: 0, // 隐藏右上角关闭按钮
        area: ['500px', 'auto'],
        content: `
            <div class="form-box" style="500px">
               <label style="width: 100px">开始时间：</label>
               <div class="layui-input-inline">
                  <input id="startTime" name="startTime"  type="text" required lay-verify="required" class="form-control" placeholder="请选择开始时间">
               </div>
           </div>
           <div class="form-box" >
               <label style="width: 100px">结束时间</label>
               <div class="layui-input-inline">
                  <input id="endTime" name="endTime"  type="text" required lay-verify="required" class="form-control" placeholder="请选择结束时间">
               </div>
           </div>
           <div class="form-box" >
              <label style="width: 100px">岗位：</label>
               <div class="layui-input-inline">
                <input id="job" name="job"  type="text" required lay-verify="required" class="form-control" placeholder="请输入岗位">
<!--                  <input id="sex" name="sex"  type="text" required lay-verify="required"  >-->
               </div>
           </div>
             
               <div class="form-box" >
               <label style="width: 100px">单位：</label>
               <div class="layui-input-inline">
               <input id="workUnitbox" name="workUnit"  type="text"  class="form-control" placeholder="请输入单位">
               </div>
           </div>
           <div class="form-box">
                <label style="width: 100px">联系人：</label>
               <div class="layui-input-inline">
               <input id="contact"   name="contact" class="form-control" type="text" placeholder="请输入联系人">
               </div>
           </div>
           <div class="form-box">
                <label style="width: 100px">联系人电话：</label>
               <div class="layui-input-inline">
               <input id="contactMobile"   name="contactMobile" class="form-control" type="text" placeholder="请输入联系人电话">
               </div>
           </div>
             
           <div style="display: flex;justify-content: flex-end">
            <button   onclick="handleworkaddSubmit()"  class="btn btn-primary btn-sm ' + '" href="#" mce_href="#" title="提交" style="background: #337ab7;border-color: #337ab7;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;" >提交</button>
	<button   onclick="handleworkaddClose()"  class="btn  btn-sm ' + '" href="#" mce_href="#" title="取消" style="background: #fff;border-color: #000;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;">取消</i></button>
</div>
        `,
        success() {
            layui.use(['upload', 'laydate'], function () {
                var layer = layui.layer;
                var upload = layui.upload;
                var loading;
                var laydate = layui.laydate;
                //执行一个laydate实例
                laydate.render({
                    elem: '#startTime' //指定元素
                });
                laydate.render({
                    elem: '#endTime' //指定元素
                });
                upload.render({
                    elem: '#drag5'
                    , url: '/common/sysFile/upload' //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
                    // ,field:'picture'
                    , done: function (res) {
                        $('#icontext5').hide()
                        $('#uploadDemoView5').removeClass('layui-hide').find('img').attr('src', res.data);
                        $("input[name='picture4']").val(res.data)
                    },

                });
            });
        }
    });
}


function addbooklist() {
    index3 = layer.open({
        type: 1,
        title: '添加证书',
        shadeClose: false, // 同样禁止点击遮罩关闭
        closeBtn: 0, // 隐藏右上角关闭按钮
        area: ['500px', 'auto'],
        content: `
            <div class="form-box" style="500px">
               <label style="width: 100px">职业(工种)：</label>
               <div class="layui-input-inline">
                  <input id="career" name="career"  type="text" required lay-verify="required" class="form-control" placeholder="请输入职业">
               </div>
           </div>
           <div class="form-box" >
               <label style="width: 100px">等级 (3 4 5级)：</label>
               <div class="layui-input-inline">
                  <input id="level" name="level"  type="text" required lay-verify="required" class="form-control" placeholder="请选择等级">
               </div>
           </div>
           <div class="form-box" >
              <label style="width: 100px">证书号：</label>
               <div class="layui-input-inline">
                <input id="number" name="number"  type="text" required lay-verify="required" class="form-control" placeholder="请输入证书编号">
<!--                  <input id="sex" name="sex"  type="text" required lay-verify="required"  >-->
               </div>
           </div>
             
               <div class="form-box" >
               <label style="width: 100px">证书图片：</label>
               <div class="layui-input-inline">
                  <div class="layui-input-block" style="margin: 0px">
                                        <div class="layui-upload-drag" style="width: 300px;" id="drag4">
                                      <p id="icontext4">点击上传，或将文件拖拽到此处</p>
                                            <div class="layui-hide" id="uploadDemoView4">
                                                <img src="" alt="上传成功后渲染" style="max-width: 196px">
                                           <input id="photo" name="picture4" type="hidden" name="born" class="form-control" type="text" placeholder="请上传证书图片">
                                            </div>
                                        </div>
                                    </div>

               </div>
           </div>
           <div class="form-box">
                <label style="width: 100px">发证日期：</label>
               <div class="layui-input-inline">
               <input id="certificateTime"   name="certificateTime" class="form-control" type="text" placeholder="请选择发证日期">
               </div>
           </div>
             
           <div style="display: flex;justify-content: flex-end">
            <button   onclick="handleaddSubmit()"  class="btn btn-primary btn-sm ' + '" href="#" mce_href="#" title="提交" style="background: #337ab7;border-color: #337ab7;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;" >提交</button>
	<button   onclick="handleaddClose()"  class="btn  btn-sm ' + '" href="#" mce_href="#" title="取消" style="background: #fff;border-color: #000;padding: 10px;
    width: 80px;
    font-size: 16px;
    margin: 10px;">取消</i></button>
</div>
        `,
        success() {
            // /////////////////////
            //////////////////////////
            layui.use(['upload', 'laydate'], function () {
                var layer = layui.layer;
                var upload = layui.upload;
                var loading;
                var laydate = layui.laydate;
                //执行一个laydate实例
                laydate.render({
                    elem: '#certificateTime' //指定元素
                });

                upload.render({
                    elem: '#drag4'
                    , url: '/common/sysFile/upload' //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
                    // ,field:'picture'
                    , done: function (res) {
                        $('#icontext4').hide()
                        $('#uploadDemoView4').removeClass('layui-hide').find('img').attr('src', res.data);
                        $("input[name='picture4']").val(res.data)
                    },

                });
            });
        }
    });
}

var addbooklistdata = []
var addworklistdata = []

function handleworkaddSubmit() {
    if (!$('#contactMobile').val() || !$('#endTime').val() || !$('#contact').val() || !$('#job').val() || !$('#startTime').val()) {

        layer.msg('请将信息填写完成！')
        return false;
    }
    if ($('#endTime').val() < $('#startTime').val()) {

        layer.msg('结束时间不能早于开始时间！')
        return false;
    }
    if (editid == 'add') {
        addworklistdata.push({
            id: '',
            contactMobile: $('#contactMobile').val(),
            contact: $('#contact').val(),
            job: $('#job').val(),
            workUnit: $('#workUnitbox').val(),
            startTime: $('#startTime').val().split('-').join('/'),
            endTime: $('#endTime').val().split('-').join('/'),
        })
        $.each(addworklistdata, function (index, item) {
            var listItem = $('<div >');
            var contactMobile = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.contactMobile);
            var contact = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.contact);
            var job = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.job);
            var workUnit = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.workUnit);
            var startTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.startTime + '-' + item.endTime);
            var deleteButton = $('<button>', {
                class: 'deleteButton',
                text: '删除'
            });

            // 绑定删除按钮的点击事件
            deleteButton.click(function (event) {
                layer.confirm('确定要删除该信息？', {
                    btn: ['确定', '取消']
                }, function () {

                    console.log(item)
                    // 删除接口
                    event.preventDefault(); // 阻止默认行为，如链接跳转
                    listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                    layer.msg('删除成功');
                })
            });
            // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
            listItem.append(startTime).append(workUnit).append(job).append(contact).append(contactMobile).append(deleteButton);
            $('#list').append(listItem);
        });
        console.log(addworklistdata)
    } else {
        editworklist.push({
            id: '',
            contactMobile: $('#contactMobile').val(),
            contact: $('#contact').val(),
            job: $('#job').val(),
            workUnit: $('#workUnitbox').val(),
            startTime: $('#startTime').val().split('-').join('/'),
            endTime: $('#endTime').val().split('-').join('/'),
        })
        lookeditworklist.push({
            id: '',
            contactMobile: $('#contactMobile').val(),
            contact: $('#contact').val(),
            job: $('#job').val(),
            workUnit: $('#workUnitbox').val(),
            startTime: $('#startTime').val().split('-').join('/'),
            endTime: $('#endTime').val().split('-').join('/'),
        })
        var listItem = $('<div >');
        var contactMobile = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text($('#contactMobile').val());
        var contact = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text($('#contact').val());
        var job = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text($('#job').val());
        var workUnit = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text($('#workUnitbox').val());
        var startTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text($('#startTime').val().split('-').join('/') + '-' + $('#endTime').val().split('-').join('/'));
        var deleteButton = $('<button>', {
            class: 'deleteButton',
            text: '删除'
        });
        // 绑定删除按钮的点击事件
        deleteButton.click(function (event) {
            layer.confirm('确定要删除该信息？', {
                btn: ['确定', '取消']
            }, function () {
                editworklist[editworklist.length].isDelete = '1'
                lookeditworklist[lookeditworklist.length].isDelete = '1'
                lookeditworklist.splice(index, 1)
                // 删除接口
                event.preventDefault(); // 阻止默认行为，如链接跳转
                listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                layer.msg('删除成功');
            })

        });
        // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
        listItem.append(startTime).append(workUnit).append(job).append(contact).append(contactMobile).append(deleteButton);
        $('#list').append(listItem);
    }

    layer.close(index4)
}

function handleworkaddClose() {
    layer.close(index4)
}

function handleaddSubmit() {
    if (!$('#career').val() || !$('#level').val() || !$('#number').val() || !$('#photo').val() || !$('#certificateTime').val()) {
        layer.msg('请将信息填写完成！')
        return false;
    }
    if (editid == 'add') {
        addbooklistdata.push({
            id: '',
            career: $('#career').val(),
            level: $('#level').val(),
            number: $('#number').val(),
            photo: $('#photo').val(),
            certificateTime: $('#certificateTime').val(),
        })
        $.each(addbooklistdata, function (index, item) {
            var listItem = $('<div >');
            var photo = $('<img src="' + item.photo + '" style="margin: 10px 27px;;width: 100px;display: inline-block;">');
            var certificateTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.certificateTime);
            var level = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.level);
            var career = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text(item.career);
            var deleteButton = $('<button>', {
                class: 'deleteButton',
                text: '删除'
            });

            // 绑定删除按钮的点击事件
            deleteButton.click(function (event) {
                layer.confirm('确定要删除该信息？', {
                    btn: ['确定', '取消']
                }, function () {
                    console.log(item)
                    addbooklistdata.splice(index, 1)
                    // 删除接口
                    event.preventDefault(); // 阻止默认行为，如链接跳转
                    listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                    layer.msg('删除成功');
                })
            });
            // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
            listItem.append(career).append(level).append(certificateTime).append(photo).append(deleteButton);
            $('#worklist').append(listItem);
        });
        console.log(addbooklistdata)
    } else {
        editbooklist.push({
            id: '',
            career: $('#career').val(),
            level: $('#level').val(),
            number: $('#number').val(),
            photo: $('#photo').val(),
            certificateTime: $('#certificateTime').val(),
        })
        lookeditbooklist.push({
            id: '',
            career: $('#career').val(),
            level: $('#level').val(),
            number: $('#number').val(),
            photo: $('#photo').val(),
            certificateTime: $('#certificateTime').val(),
        })

        var listItem = $('<div >');
        var photo = $('<img src="' + $('#photo').val() + '" style="margin: 10px 27px;;width: 100px;display: inline-block;">');
        var certificateTime = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text($('#certificateTime').val());
        var level = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text($('#level').val());
        var career = $('<span style="padding: 10px;width: 150px;display: inline-block;text-align: center;">').text($('#career').val());
        var deleteButton = $('<button>', {
            class: 'deleteButton',
            text: '删除'
        });

        // 绑定删除按钮的点击事件
        deleteButton.click(function (event) {
            layer.confirm('确定要删除该信息？', {
                btn: ['确定', '取消']
            }, function () {
                editbooklist[editbooklist.length - 1].isDelete = '1'
                lookeditworklist[lookeditworklist.length - 1].isDelete = '1'
                lookeditbooklist.splice(lookeditbooklist.length - 1, 1)
                // 删除接口
                event.preventDefault(); // 阻止默认行为，如链接跳转
                listItem.remove(); // 删除当前点击的按钮所在的<li>元素
                layer.msg('删除成功');
            })

        });
        // 将文本节点和删除按钮添加到<li>中，然后将<li>追加到<ul>
        listItem.append(career).append(level).append(certificateTime).append(photo).append(deleteButton);
        $('#worklist').append(listItem);
    }

    layer.close(index3)
}

function handleaddClose() {
    layer.close(index3)
}


function batchRemove() {
    var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行，当没有选择的记录时，返回一个空数组
    if (rows.length == 0) {
        layer.msg("请选择要删除的数据");
        return;
    }
    layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", {
        btn: ['确定', '取消']
        // 按钮
    }, function () {
        var ids = new Array();
        // 遍历所有选择的行数据，取每条数据对应的ID
        $.each(rows, function (i, row) {
            ids[i] = row['id'];
        });
        $.ajax({
            type: 'POST',
            data: {
                "ids": ids
            },
            url: prefix + '/batchRemove',
            success: function (r) {
                if (r.code == 0) {
                    layer.msg(r.msg);
                    reLoad();
                } else {
                    layer.msg(r.msg);
                }
            }
        });
    }, function () {

    });
}
